package com.yishusmt.wechatapi.wechatdev.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * @author zhangyi
 * @date 2018/8/27 11:02
 */
@RestController
@RequestMapping("/test")
@Api(description = "测试连接")
public class TestConnectionController {

    @GetMapping("/con")
    @ApiOperation(value = "测试连接是否成功",httpMethod = "GET")
    public String con(HttpServletRequest request){
        Map<String, String[]> parameterMap = request.getParameterMap();
        Set<Map.Entry<String, String[]>> entries = parameterMap.entrySet();
        Iterator<Map.Entry<String, String[]>> iterator = entries.iterator();
        while (iterator.hasNext()){
            Map.Entry<String, String[]> next = iterator.next();
            String key = next.getKey();
            System.out.println(key);
            Arrays.asList(next.getValue()).stream().forEach(e-> System.out.println(e));
            System.out.println("--------------------");
        }
        return "连接成功";
    }

}
